<?php echo form_open_multipart('panel/grabar_novedad',array('id' => 'form')) ?>
<table width="80%" cellspacing="0" cellpadding="2" border="0">
    <tbody>
    <tr>
        <td>
            <table width="100%" cellspacing="0" cellpadding="0" border="0">
                <tbody>
                <tr>
                    <td class="pageHeading"><h2><?php echo $accion; ?> Novedad</h2></td>
                    <td align="right" class="pageHeading"><img width="57" height="40" border="0" alt=""
                                                               src="/imagenes/pixel_trans.gif"></td>
                </tr>
                </tbody>
            </table>
        </td>
    </tr>
    <tr>
        <td><img width="1" height="10" border="0" alt="" src="/imagenes/pixel_trans.gif"></td>
    </tr>
    <tr>
        <td>
            <table cellspacing="0" cellpadding="2" border="0" width="100%">
                <tbody>
                <tr>
                    <td class="main">Fecha:</td>
                    <td class="main"><input  id="datepicker" type="text" name="fecha" value="<?php echo isset($registro['fecha'])? $registro['fecha']:''; ?>"/>
                    </td>
                </tr>
                <tr>
                    <td class="main">Nombre:</td>
                    <td class="main"><input type="text" size="50" maxlength="100" name="nombre" value="<?php echo isset($registro['nombre'])? $registro['nombre']:''; ?>"/>
                    </td>
                </tr>
                <tr>
                    <td class="main">Descripción Corta:</td>
                    <td class="main"><textarea  cols="20" rows="3" name="descripcion_corta"><?php echo isset($registro['descripcion_corta']) ? $registro['descripcion_corta']: ''; ?></textarea></td>
                    <td>&nbsp;</td>
                </tr>
                <tr>
                    <td class="main">Descripción:</td>
                    <td class="main"><textarea  cols="40" rows="10" name="descripcion"><?php echo isset($registro['descripcion']) ? $registro['descripcion']: ''; ?></textarea></td>
                    <td>&nbsp;</td>
                </tr>
                <tr>
                    <td class="main">Orden:</td>
                    <td class="main"><input size="5" type="text" id="orden" name="orden"
                                            value="<?php echo isset($registro['orden']) ? $registro['orden']: ''; ?>"></td>
                    <td>&nbsp;</td>
                </tr>
                <tr>
                    <td class="main">Imagen:</td>
                    <td class="main"><img width="24" height="15" border="0" alt=""
                                          src="/imagenes/pixel_trans.gif">&nbsp;<input size="5"
                                                                                       type="file"
                                                                                       name="imagen"><br><img
                            width="24" height="15" border="0" alt=""
                            src="/imagenes/pixel_trans.gif"></td>
                    <?php if (isset($registro['imagen'])) { ?>
                        <td class="main">
                            <img width="150" height="100" border="0" alt=""
                                 src="/novedades/<?php echo $registro['imagen']; ?>">&nbsp;</td>
                    <?php } ?>
                </tr>
                <tr >
                    <td colspan="2"><img width="1" height="10" border="0" alt="" src="/imagenes/pixel_trans.gif"></td>
                </tr>
                </tbody>
            </table>
        </td>
    </tr>
    <tr>
        <td><img width="1" height="10" border="0" alt="" src="/imagenes/pixel_trans.gif"></td>
    </tr>
    <tr>
        <td align="center" class="main">
            <button id="categoria_guardar" >Guardar</button>
            <button id="categoria_cancelar" >Cancelar</button>
            <input type="hidden" name="codigo" value="<?php echo isset($registro['cod_novedad'])?$registro['cod_novedad']:''; ?>" />
        </td>
    </tr>
    </tbody>
</table>
</form>
<script type="text/javascript">
    $(document).ready(function() {
        $("#categoria_guardar").button().click(function(){
            T.Aplicacion.submit('<?php echo site_url("/panel/grabar_novedad");?>');
        });
        $("#categoria_cancelar").button().click(function(){
            T.Aplicacion.submit('<?php echo site_url("/panel/novedades");?>');
        });

        $(function() {
            $( "#datepicker" ).datepicker({ dateFormat: "dd-mm-yy" });
        });

    });
</script>